UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZCmoj+hDbl3bkesBNiUkEuG6oUNr0HhGjRIG1b4WyR4='
WHERE
key_id = '6a3a2b94d3099d85cecb70e92516fae0454751cb585058d0ab1efa8012860d23'
AND (
token = 'ZCmoj+hDbl3bkesBNiUkEuG6oUNr0HhGjRIG1b4WyR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)