UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9b5+HHBGqG8rb1T05wMAET+dpl8dTlPDAfylaGhYBeA='
WHERE
key_id = 'c066d85759b02b68bd4f2fa4dfdea3eb74726d2c27c784d68c2626e769dccac9'
AND (
token = '9b5+HHBGqG8rb1T05wMAET+dpl8dTlPDAfylaGhYBeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)