UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4ON4cbob2OEaHejmB4WIPrhVrPDpLXWLn0Hk6J07dY4='
WHERE
key_id = 'e564f4489365c1ea51988a811866d1ad2a39a7ea46002385b1df56e0facdd774'
AND (
token = '4ON4cbob2OEaHejmB4WIPrhVrPDpLXWLn0Hk6J07dY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)