UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zxBf4GG1mYJcGn/JV0ATtvgHzCFWXiGszuJH9WYKaxs='
WHERE
key_id = 'b268effe806ede229d2732a21b992eaf7346574e6e78098be0ea354b8b32a2dc'
AND (
token = 'zxBf4GG1mYJcGn/JV0ATtvgHzCFWXiGszuJH9WYKaxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)