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