UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ipMiYAYzR4/+0XLGZDgZh+UtGMLKzy06uLI6oXAzhyA=' 
WHERE 
  key_id = 'cfcf1879e633d512aece3e2b5c1c886d7cdf0c74388d58ca0a83e230f9aa0693' 
  AND (
    token = 'ipMiYAYzR4/+0XLGZDgZh+UtGMLKzy06uLI6oXAzhyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038