UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wzAyQ7IIX9dEsUn4B5kBt7HFmjpXxa1SUNgnzfaGmu4=' 
WHERE 
  key_id = '373c2d9bdbe24a0c8bee46218f61f51072e56d303a3ef271a1ea315fe73e2a61' 
  AND (
    token = 'wzAyQ7IIX9dEsUn4B5kBt7HFmjpXxa1SUNgnzfaGmu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040