UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A+a/7LSj2PbODbRs4/1bGYNPMZ6O1qH0HTyheEqR0JA=' 
WHERE 
  key_id = '597fb25dce9449f6b3528e197493187aedce107520e9833fdc7ec21ae7c7c4ed' 
  AND (
    token = 'A+a/7LSj2PbODbRs4/1bGYNPMZ6O1qH0HTyheEqR0JA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055