UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ynp4Snl8mueCy9dhz9LxT4LkqxMBAAU0bYry4uQ/otg=' 
WHERE 
  key_id = '2b5804d719062d5f8ce76eca83df024a757fc1f5b389b4456aac380269e9a2d5' 
  AND (
    token = 'Ynp4Snl8mueCy9dhz9LxT4LkqxMBAAU0bYry4uQ/otg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025