UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KA3X3p9cf8EFRzRds0SiU/F9BQBN5MXOGXCrQUk1WaY=' 
WHERE 
  key_id = '3fe17e805d643010ed87975af8e4fdbdda31497796d02111048e03ae1eb3493b' 
  AND (
    token = 'KA3X3p9cf8EFRzRds0SiU/F9BQBN5MXOGXCrQUk1WaY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027