UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g4ZWD3aiV4kaK9U+l33KveJnVqBSVjno4+LLjNYbXQM=' 
WHERE 
  key_id = '796474710d320e2eac2ef9ebf0206f3520ef5595b86bd366c561b5e87369bb13' 
  AND (
    token = 'g4ZWD3aiV4kaK9U+l33KveJnVqBSVjno4+LLjNYbXQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033