UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CWzWoD3vwtAlVVI4BfXDSAXfKV5VHHkBrjb6W/u+dEU='
WHERE
key_id = 'e4b0e16968c9678841f51fbd7dbd73726e5fd9f4a4226ea051e016be31281ea3'
AND (
token = 'CWzWoD3vwtAlVVI4BfXDSAXfKV5VHHkBrjb6W/u+dEU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)