UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MsnAKQgENGnCkqp0YfMZTVtmWcyF9net7+TpAMpclsc='
WHERE
key_id = 'd97ef3d7d86438fa37e444629c309794c4705c566dc81b96cbb0395de96deff7'
AND (
token = 'MsnAKQgENGnCkqp0YfMZTVtmWcyF9net7+TpAMpclsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)