UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jIo/XxKmqh+uHN+SMGN3sSLSf36hdJqT3jMj3znJgtg='
WHERE
key_id = '90c3359e4b6610e5f70a01f114e9516a9581d616df9d9727e7c9ca6cd244eef2'
AND (
token = 'jIo/XxKmqh+uHN+SMGN3sSLSf36hdJqT3jMj3znJgtg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)