UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+5YQ8cOBWOYHHt1Pfsrv+h0nAUPkWJgK9kdLX+iOjgs='
WHERE
key_id = '4d1fa78674902e971d372eaff34438f771d54d62631c37b83f22d6140485aafd'
AND (
token = '+5YQ8cOBWOYHHt1Pfsrv+h0nAUPkWJgK9kdLX+iOjgs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)