UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AzYBJ0+7sAoEIHhlbJszoRypLmfe2W//yLSNmHG/y10='
WHERE
key_id = 'd3273d199b82810ef58e4d47c4a38b325e9b2e901478ce40a5617ddbe534bd61'
AND (
token = 'AzYBJ0+7sAoEIHhlbJszoRypLmfe2W//yLSNmHG/y10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)