UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MOM8dTmbo5lCBMgdv+L78pPptWkrMNEnCT6m444gS+s='
WHERE
key_id = 'e8f3e35d4f8dcfba6b5a91cab8ab8066103420330fc04180737b8c09eb6fb8e2'
AND (
token = 'MOM8dTmbo5lCBMgdv+L78pPptWkrMNEnCT6m444gS+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)