UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'agoQtiiVTLViJXqqQs8ZeYwesrVh2dIjXIEn+uXl9TE='
WHERE
key_id = '445113f9cddc5137afea6a28ed6cd10eff99e52e1b91a8d6a041735b24c17515'
AND (
token = 'agoQtiiVTLViJXqqQs8ZeYwesrVh2dIjXIEn+uXl9TE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)