UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kKlrZEAevS367dWTjEostaMSoC9PwT7Dy4R56cQ2dRA='
WHERE
key_id = 'cd4b7068f9ac1aa48c41648cb2ef88aa066fd35c6f866406f58c3ddf2fde9842'
AND (
token = 'kKlrZEAevS367dWTjEostaMSoC9PwT7Dy4R56cQ2dRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)