UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/CP5EsrHjsyctiFIiozo6MlX4fvpxfKdrQV5c0zXC04='
WHERE
key_id = 'e22655dc1cf8642abaa878ea1097e49b1433efd27054446d892da04c891a0e6a'
AND (
token = '/CP5EsrHjsyctiFIiozo6MlX4fvpxfKdrQV5c0zXC04='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)