UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lNTITHIjMMZDmuid7Q2Gd9INfkbziys0kYhI6Rc17rU='
WHERE
key_id = '51a480066c1280ea9e15b8510658f62e49814350901a0dd4fc0083054176e004'
AND (
token = 'lNTITHIjMMZDmuid7Q2Gd9INfkbziys0kYhI6Rc17rU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)