UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jIfjgDFdQEGouDsvaLz7NxMQp7eJBo+9jl/WeUv4XxI='
WHERE
key_id = '20f5c4cd2fd96238565e6620e58ef4f3d077ba15548981d1ca221b2354aee6f8'
AND (
token = 'jIfjgDFdQEGouDsvaLz7NxMQp7eJBo+9jl/WeUv4XxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)