UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S6ewDtKXXLab7BnHfKbDLw30yafRNoGFqQLxA+jFAxs='
WHERE
key_id = '6547fe48f5ad873785084bc1f7b86f702cc8a91d630036a1a1aebe4eb636ab6a'
AND (
token = 'S6ewDtKXXLab7BnHfKbDLw30yafRNoGFqQLxA+jFAxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)