UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HMV7pLTPn94NgFPEkOXLEOnL0uWjfbVwfSH+roRGQag=' 
WHERE 
  key_id = '7b4dc14c17707eb96908a82def463503a2c918405968eb009d65213507862625' 
  AND (
    token = 'HMV7pLTPn94NgFPEkOXLEOnL0uWjfbVwfSH+roRGQag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035