UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+riaiJXmz6mVY/spPz9sK+sDgj6VDPKhKodFNGt8u0w='
WHERE
key_id = 'be16fdbe1707eee1920c1fa1753f45ea2edf8f986bfc848a3c38b233dd091109'
AND (
token = '+riaiJXmz6mVY/spPz9sK+sDgj6VDPKhKodFNGt8u0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)