UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QlzKPnEt+rUKNBcxXdWasyPO6BIMmKxfPSUIxMztFxE=' 
WHERE 
  key_id = 'fc363bfcdac76e511acd38744ef32d565f28b22ef2abbfc3496520c54b657465' 
  AND (
    token = 'QlzKPnEt+rUKNBcxXdWasyPO6BIMmKxfPSUIxMztFxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015