UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lmUGr5+A5jbw6FuiznQ7BLsGFsoy1GXHgXgjqTNfPGk=' 
WHERE 
  key_id = '972c5c21d38abf9d437831a879bb45d0257c98e18486d2b3c017a4f02c059f4b' 
  AND (
    token = 'lmUGr5+A5jbw6FuiznQ7BLsGFsoy1GXHgXgjqTNfPGk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026