UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xnvw0jSdPQgn7OUFjmNrZs57V86nGLRCtXe59lAIsvc='
WHERE
key_id = '46b1f616073e086d5cc4e2213e0e960501ae7055c3eb9e9b14a4c580653842a2'
AND (
token = 'Xnvw0jSdPQgn7OUFjmNrZs57V86nGLRCtXe59lAIsvc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)