UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9fDjJW+Y4Awk+H19dqUcYaWrqTa8Bo7wrV904HClv38=' 
WHERE 
  key_id = 'df7f69a392072fe7b1b6b37da0487859ffd4e3d8fbdaf439fee29ee1f7d34c13' 
  AND (
    token = '9fDjJW+Y4Awk+H19dqUcYaWrqTa8Bo7wrV904HClv38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022