UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RiGis9vNd8AU8Ebh+o5UjqxqDQYbiXQljbMYcw/SgE4=' 
WHERE 
  key_id = '2fc27e4a97282dcd2ca09f69c0c87d0440afe0282fd2fc0d2659be38108d8959' 
  AND (
    token = 'RiGis9vNd8AU8Ebh+o5UjqxqDQYbiXQljbMYcw/SgE4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027