UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7KAkK7m+/bIQVw74fS09KkG8EulEF3wRKqQ8eQift+8=' 
WHERE 
  key_id = '771702d8e1e59d22b8268b056ff030caf98e84a0ef34d1021654b61b192507cd' 
  AND (
    token = '7KAkK7m+/bIQVw74fS09KkG8EulEF3wRKqQ8eQift+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042