UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9a+ofnDYfVyWpE6ylKXuyF6vOgUWzkGVjub73/F1BhE='
WHERE
key_id = 'b2773ac45daf6359eb0f24a45358007ba3fbd445cae6ca60b11eeff510eb56d4'
AND (
token = '9a+ofnDYfVyWpE6ylKXuyF6vOgUWzkGVjub73/F1BhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)