UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Ak5V3/UcsRDkmjGyJcDfzgewcJpVGbrdMroxET0LsM='
WHERE
key_id = '2ee9e586eef6f0465dc29f5216224ee612561e7635b2592c0ea9da67335db042'
AND (
token = '0Ak5V3/UcsRDkmjGyJcDfzgewcJpVGbrdMroxET0LsM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)