UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QbnWFTJG2YzNKlvs1VRaFpcaBuv2LDHAwSnHRyNKWSs=' 
WHERE 
  key_id = '4c0c4aaef34b8a26ca2c6fcbc28f929e118979d394fed26102da2bc6c1ffe44b' 
  AND (
    token = 'QbnWFTJG2YzNKlvs1VRaFpcaBuv2LDHAwSnHRyNKWSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025