UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OUg9NyeQhgZ/hUmC2cembutwYcTzzRh8yooFJCjtgcI=' 
WHERE 
  key_id = '3f2cec709ed4d78e9e110d8b5507129f185818c90a79b49c78b3479fc7724310' 
  AND (
    token = 'OUg9NyeQhgZ/hUmC2cembutwYcTzzRh8yooFJCjtgcI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026