UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RLdj48Dy7+Pr2x9mH0hgqd8iTxgqutz+kk78F18i2Aw=' 
WHERE 
  key_id = '853b344a8beb820c2dd2ad17edcc6d72b06d6113526fabfef7f0847fe47049f6' 
  AND (
    token = 'RLdj48Dy7+Pr2x9mH0hgqd8iTxgqutz+kk78F18i2Aw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031