UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k5W4V226E+qTnR5JdkSz67tjU/7KgWt4V6A938QJ9kY=' 
WHERE 
  key_id = 'da8759ff2f8964e0efcf5b50701035cf306aa5e0145691942a180be327d4fb10' 
  AND (
    token = 'k5W4V226E+qTnR5JdkSz67tjU/7KgWt4V6A938QJ9kY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016