UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x1aeciz02W/AsBZOUHKSMdJ2pBXK0jxG+plok+L8/6E='
WHERE
key_id = '482850850bc586132c268174758b31c8e7f759197a43d8bb8c7062c1f746fd23'
AND (
token = 'x1aeciz02W/AsBZOUHKSMdJ2pBXK0jxG+plok+L8/6E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)