UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n12O/XTe+fMKRqETki0QCiK1/a/MdgSkTkuKD4HoJVg='
WHERE
key_id = '99bae3abee96ab4a54d1076ae186ace67cb5f2f0a86789afa3af172f51e688c5'
AND (
token = 'n12O/XTe+fMKRqETki0QCiK1/a/MdgSkTkuKD4HoJVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)