UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '12qlLpDVrOOS5LwgoEmBEIxfL86g3XVKDwO1rFqh8Vw='
WHERE
key_id = 'f8123baf56da899d6db953e79ff1cdd6a59884243a0fded94224b4f0bee90b9a'
AND (
token = '12qlLpDVrOOS5LwgoEmBEIxfL86g3XVKDwO1rFqh8Vw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)