UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lc28FbpKzM47UvaNqr8z5caz7dchn9kO2feo+yPOeJ8='
WHERE
key_id = '8fa0e272f59566c786f19a3aa3ec1327a19b1584e33ffaa2b6df9142d42bcaa4'
AND (
token = 'lc28FbpKzM47UvaNqr8z5caz7dchn9kO2feo+yPOeJ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)