UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DD713kkKTTRtuZM/WAvEuMM0Y/QnIcyM3WIcFJYaYeo=' 
WHERE 
  key_id = '1da26abfb8577d39fc24fa32546de70e470b1791588a5da33856d61db5fa3386' 
  AND (
    token = 'DD713kkKTTRtuZM/WAvEuMM0Y/QnIcyM3WIcFJYaYeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051