UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VtuUx1Bjk2pVn6C1QSdk73TrDOzvPbDoPlR+QwV5w/s=' 
WHERE 
  key_id = 'd80ce688bac97716c3b1857e44aee3814a79ca215d204818cd399385579b62e7' 
  AND (
    token = 'VtuUx1Bjk2pVn6C1QSdk73TrDOzvPbDoPlR+QwV5w/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032