UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hp3YXQOYynabt0Y/A86c6QL7JlOlp9yILoIBqm48HyA=' 
WHERE 
  key_id = '401a0b0a6526d69904b7b4f378efbe7eba59b1016f5df8e9c5dab56ab16e689b' 
  AND (
    token = 'Hp3YXQOYynabt0Y/A86c6QL7JlOlp9yILoIBqm48HyA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035