UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1mR2/0T7Pq8paNaZNd571dl4fSdzM/iS/nMQCWx/VoE=' 
WHERE 
  key_id = 'a4d3bc3a54623dd93617bb2d2c89caf278a86417a775a8d918baf1796205e264' 
  AND (
    token = '1mR2/0T7Pq8paNaZNd571dl4fSdzM/iS/nMQCWx/VoE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030