UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NiqDkWj3JaFHWb8DWP3IS/vWIDYXHpdjxb41sKql+a4=' 
WHERE 
  key_id = 'd04112877a5a76b8f86532252da6e8fa3c8afe16cd55c4e597a037451759586a' 
  AND (
    token = 'NiqDkWj3JaFHWb8DWP3IS/vWIDYXHpdjxb41sKql+a4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039