UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DLp4gxZ0tslKnx1Zc+pD45yy4ytIA1TayYiKp2raygg='
WHERE
key_id = '46c551ae5d359ad3504a362350e88f9b1d1eb214d4c0774a750e4099f2f4cd12'
AND (
token = 'DLp4gxZ0tslKnx1Zc+pD45yy4ytIA1TayYiKp2raygg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)