UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XFR7gHIRK6AaADnfE+4hmlbhLNNOpP1IYwFijE+myso=' 
WHERE 
  key_id = 'e147a64746a77aa6457f8bbcd8de476713760c871a42dd1273e09ef39d2285b8' 
  AND (
    token = 'XFR7gHIRK6AaADnfE+4hmlbhLNNOpP1IYwFijE+myso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019