UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X3+dBuz70rD/4Im6R/Kj/MnjhfOjF58fyo+ix9RYvZA=' 
WHERE 
  key_id = '870a9a60aa10b082656bc569f3e4d9ca5d8ecc39b1c144db3e17d7395a625c87' 
  AND (
    token = 'X3+dBuz70rD/4Im6R/Kj/MnjhfOjF58fyo+ix9RYvZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030